<?php
class Root {
	protected $field = array();
	public function __get( $key ) {
		if( !isset( $this->field[ $key ] ) ) {
            return null;
        }
		return $this->field[ $key ];
	}
	public function __set( $key, $value ) {
		$this->field[ $key ] = $value;
	}
	public function __construct() {
		$this->field[ "id" ] = null;
		$this->field[ "name" ] = null;
		$this->typeName = "asdfasfasdf";
	}
	public function getID() {
		return $this->field[ "id" ] * 3;
	}
	public function getName() {
		return "name: ".$this->field[ "name" ];
	}
	protected $dbname;
	public function getDbName() {
		return $this->dbname;
	}
	protected static $typeName = "[Root Type]";
	public static function getStaticType() {
		return static::$typeName;
	}
	protected static function setStaticType( $val ) {
		self::$typeName = $val;
	}
	public function printName( ) {
		echo "I am $this->name!<br/>";
	}
	protected static $qstr;// = "select * from static::$typeName";
	public function add() {
		static::$qstr = "select * from ".static::$typeName;
		echo static::$qstr;
	}
	public static function create() {
		echo "<br/>class: ".get_called_class();
		//$cls = get_class($this);
		//return new $cls();
	}
}
?>